IF exists(SELECT * FROM dbo.sysobjects WHERE name='afwezigenIsSpecialeDag' AND xtype='FN') 
BEGIN
	DROP FUNCTION afwezigenIsSpecialeDag
END
GO

create   function afwezigenIsSpecialeDag
(@klas varchar(5),
 @datum datetime)
returns bit
begin
  declare @res bit
  if exists(select * from kalenderSpecialeDagen where (@datum = datum) 
	and (@klas like replace(klasgroep,'*','%'))) set @res = 1
  else set @res = 0
  return @res
end